package cn.bgs.mapper;


import cn.bgs.pojo.PaymentType;
import cn.bgs.vo.Bill;
import cn.bgs.pojo.User;
import cn.bgs.vo.Livingexpenses;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
 * <p>
 * 缴费类型表(账单表) Mapper 接口
 * </p>
 *
 * @author cf
 * @since 2022-06-07
 */
@Mapper
public interface PaymentTypeMapper extends BaseMapper<PaymentType> {

    /**
     * 获取用户所有的缴费信息
     * @param id
     * @return
     */
    List<Livingexpenses> cfMypayment(Integer id);

    /**
     * 添加缴费
     * @param paymentType
     * @return
     */
    int cfInsertPayment(PaymentType paymentType);

    /**
     * 获取账户余额
     * @param id
     * @return
     */
    User getUsermoney(Integer id);

    /**
     * 支付
     * @param paybalance
     * @return
     */
    int cfPayment(@Param("paybalance") Double paybalance, @Param("id") Integer id);

    /**
     * 支付成功之后改变支付状态
     * @param payId
     */
    void uupdatePaymentType(Integer payId);

    /***
     * 充值
     * @param id
     * @param newmoney
     * @return
     */
    int cfRecharge(@Param("id") Integer id, @Param("newmoney") Double newmoney);

    /**
     * 查询所有支付账单
     * @param id
     * @return
     */
    List<PaymentType> cfGetAllcost(@Param("id") Integer id,@Param("type") String type,@Param("month")String month);
    List<Bill> findBill(@Param("paymentState") String paymentState,@Param("type") String type,@Param("nametype") String nametype,@Param("name") String name);

    Integer delBill(Integer paymentTypeId);

    Integer addBill(Bill bill);

    Integer updateBill(Bill bill);

}
